import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:osg/controllers/custom_widget.dart';
import 'package:osg/controllers/http.dart';

class MallIntegral extends StatefulWidget {
  const MallIntegral({super.key});
  @override
  State<MallIntegral> createState() => _HomePageState();
}

class _HomePageState extends State<MallIntegral>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;

  getInfo(){
   Get.find<HTTPS>().getData('/starr/list', {
    'page':"1",
    "per_page":'20'
   }).then((res){
        if(res!=null){
          
        }
      });
}

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
     WidgetsBinding.instance.addPostFrameCallback((_) {
      getInfo();
    });
  }

  

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xffffffff),
        title: Text('积分明细'),
        centerTitle: true,
        bottom: TabBar(
            indicatorColor: Color(0XFF0F172B),
            indicatorWeight: 3.0,
            dividerColor: Color(0XFFF8F9FD),
            labelColor: Color(0XFF0F172B),
            labelPadding: EdgeInsets.symmetric(vertical: 5),
            unselectedLabelColor: Color(0xff999999),
            dividerHeight: 3,
            indicatorSize: TabBarIndicatorSize.tab,
            controller: _tabController,
            tabs: [
              Text(
                'ST明细',
                style: TextStyle(fontSize: 14),
              ),
              Text(
                'SP明细',
                style: TextStyle(fontSize: 14),
              )
            ]),
      ),
      body: TabBarView(
        controller: _tabController,
        children: [
          ListView(
            padding: EdgeInsets.symmetric(horizontal: 15,vertical: 15),
            children: [
              Row(
                children: [
                  Container(
                    width: 60,
                    alignment: Alignment.center,
                    height: 28,
                    margin: EdgeInsets.only(right: 15),
                     decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular((25)),
                      color: Color(0XFFF8F9FD)
                     ),
                     child: Text('全部',style: TextStyle(fontSize: 12,color: Color(0XFF0F172B))),
                  ),
                  Container(
                    width: 60,
                    margin: EdgeInsets.only(right: 15),
                    alignment: Alignment.center,
                    height: 28,
                     decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular((25)),
                      color: Color(0XFFF8F9FD)
                     ),
                     child: Text('收入',style: TextStyle(fontSize: 12,color: Color(0XFF0F172B))),
                  ),
                  Container(
                    width: 60,
                    margin: EdgeInsets.only(right: 15),
                    alignment: Alignment.center,
                    height: 28,
                     decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular((25)),
                      color: Color(0XFFF8F9FD)
                     ),
                     child: Text('支出',style: TextStyle(fontSize: 12,color: Color(0XFF0F172B))),
                  ),
                ],
              ),
          isdata(),
              for(var item in [])
              Container(
                margin: EdgeInsets.only(top: 15),
                padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
                decoration: BoxDecoration(
                    color: Color(0XFFF8F9FD),
                    borderRadius: BorderRadius.circular(10)),
                child: Row(
                  children: [
                    Expanded(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          children: [
Text('积分提现',
                            style: TextStyle(
                                fontSize: 14,
                                color: Color(0XFF0F172B),
                                fontWeight: FontWeight.bold)),
                                SizedBox(width: 5,),

                                Text('审核失败',

                            style: TextStyle(
                                fontSize: 12,
                                color: Color(0XFFFF4343),
                              )),
                          ],
                        ),
                        

                                SizedBox(height: 8,),

                        Text('2022-01-05 16:00:00',
                            style: TextStyle(
                                fontSize: 12, color: Color(0XFF999999))),
                      ],
                    )),
                    SizedBox(
                      width: 20,
                    ),
                    Text('-99',
                        style: TextStyle(
                          fontSize: 18,
                          color: Color(0XFF0F172B),
                        )),
                  ],
                ),
              ),
            ],
          ),
          ListView(
            padding: EdgeInsets.symmetric(horizontal: 15,vertical: 15),
            children: [
              Row(
                children: [
                 
                  Container(
                    width: 60,
                    alignment: Alignment.center,
                    height: 28,
                    margin: EdgeInsets.only(right: 15),
                     decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular((25)),
                      color: Color(0XFFF8F9FD)
                     ),
                     child: Text('全部',style: TextStyle(fontSize: 12,color: Color(0XFF0F172B))),
                  ),
                  Container(
                    width: 60,
                    margin: EdgeInsets.only(right: 15),
                    alignment: Alignment.center,
                    height: 28,
                     decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular((25)),
                      color: Color(0XFFF8F9FD)
                     ),
                     child: Text('收入',style: TextStyle(fontSize: 12,color: Color(0XFF0F172B))),
                  ),
                  Container(
                    width: 60,
                    margin: EdgeInsets.only(right: 15),
                    alignment: Alignment.center,
                    height: 28,
                     decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular((25)),
                      color: Color(0XFFF8F9FD)
                     ),
                     child: Text('支出',style: TextStyle(fontSize: 12,color: Color(0XFF0F172B))),
                  ),
                ],
              ),
                isdata(),
              for(var item in [])
              Container(
                margin: EdgeInsets.only(top: 15),
                padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
                decoration: BoxDecoration(
                    color: Color(0XFFF8F9FD),
                    borderRadius: BorderRadius.circular(10)),
                child: Row(
                  children: [
                    Expanded(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text('超现实元宇宙数字艺术展厅',
                            style: TextStyle(
                                fontSize: 14,
                                color: Color(0XFF0F172B),
                                fontWeight: FontWeight.bold)),

                                SizedBox(height: 8,),

                        Text('2022-01-05 16:00:00',
                            style: TextStyle(
                                fontSize: 12, color: Color(0XFF999999))),
                      ],
                    )),
                    SizedBox(
                      width: 20,
                    ),
                    Text('-99',
                        style: TextStyle(
                          fontSize: 18,
                          color: Color(0XFF0F172B),
                        )),
                  ],
                ),
              ),
            ],
          ),
        ],
      )
    );
  }
}
